package com.tao.mapper;

import com.tao.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
    @Select("select * from sys_user where username = #{username}")
    User findByUsername(String username);

    @Insert("insert into sys_user(username,password,nickname,email,phone,address,create_time) values" +
            "(#{username},#{password},#{nickname},#{email},#{phone},#{address},#{createTime})")
    int register(User user);

    int update(User user);

    @Delete("delete from sys_user where id = #{id}")
    int delete(@Param("id") Integer id);

    @Select("select * from sys_user where username like concat(#{username}) limit #{pageNum},#{pageSize}")
    List<User> selectPage(Integer pageNum, Integer pageSize, String username);

    @Select("select count(*) from sys_user where username like concat(#{username})")
    Integer selectTotal(String username);
}
